import Login from '@/views/Login.vue'
import Index from '@/views/Index.vue'
import Layout from '@/layout/index.vue'
import * as vueRouter from 'vue-router';
const routes = [
  // {
  //   path: '/',
  //   redirect: '/index'
  // },
  {
    path:'/login',
    name:'login',
    component: Login 
  },{
    // 使用layout
    path: '/',
    name:'',
    component: Layout,
    redirect:'/index',
    children:[{
      path:'index',
      component: Index
    },{
      path:'table',
      component: ()=>import('@/views/Table/Table.vue'),
      redirect: '/table/table1',
      children:[{
        path: '/table1',
        component: ()=>import('@/views/Table/Table.vue'),
      },{
        path: '/table2',
        component: ()=>import('@/views/Table/Table2.vue'),  
      }]
    },{
      path:'form',
      component: ()=>import('@/views/Form.vue')
    }]
  },{
    // 使用layout
    path: '/table',
    name:'表格',
    component: Layout,
    redirect:'/table/table1',
    children:[{
      path:'table1',
      component: ()=>import('@/views/Table/Table.vue'),
    },{
      path:'table2',
      component: ()=>import('@/views/Table/Table2.vue'),
      
    }]
  }
]

const router = vueRouter.createRouter({
  history:vueRouter.createWebHashHistory(),
  routes,
})


export default router